package com.shengqin.controller.exam;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shengqin.common.pojo.CommonPage;
import com.shengqin.common.pojo.CommonResult;
import com.shengqin.entity.PlanFreeTest;
import com.shengqin.service.IPlanFreeTestService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("admin/v1/freeTest")
public class FreeTestController {

    @Resource
    private IPlanFreeTestService freeTestService;

    @PostMapping("queryPage")
    public CommonResult<Page<PlanFreeTest>> queryPage(@RequestBody CommonPage<PlanFreeTest> commonPage){
        return CommonResult.data(freeTestService.queryPage(commonPage));
    }

    @PostMapping("refresh")
    public CommonResult<Boolean> refresh(@RequestBody PlanFreeTest params){
        return CommonResult.data(freeTestService.refresh(params));
    }

    @PostMapping("delete")
    public CommonResult<Boolean> delete(@RequestBody PlanFreeTest planFreeTest){
        return CommonResult.data(freeTestService.removeById(planFreeTest.getId()));
    }

}
